package com.yonyou.cyxdms.basedata.service.service.templateconf;

import com.yonyou.cyx.framework.util.bean.ApplicationContextHelper;
import com.yonyou.cyxdms.basedata.client.domains.vo.PageTemplateConfVO;
import com.yonyou.cyxdms.basedata.service.repository.templateconf.PageTemplateConfMapper;
import com.yonyou.cyxdms.framework.bean.dto.user_info.LoginInfoDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 动态页面模板配置信息 服务实现类
 * </p>
 *
 * @author renwd
 * @since 2019-09-23
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class PageTemplateConfServiceImpl  implements PageTemplateConfService {

    @Autowired
    PageTemplateConfMapper pageTemplateConfMapper;

    /**
     * 根据配置代码查询页面模板配置信息
     *
     * @param confCode
     * @return java.util.List<com.yonyou.cyxdms.basedata.service.vo.templateconf.PageTemplateConfVO>
     * @author renwd
     * @since 2019/9/23
     */
    @Override
    public List<PageTemplateConfVO> listPageTemplateConfByConfCode(Integer confCode) {
        LoginInfoDto loginInfoDto = ApplicationContextHelper.getBeanByType(LoginInfoDto.class);
        return pageTemplateConfMapper.listPageTemplateConfByConfCode(loginInfoDto.getAppId(), loginInfoDto.getOwnerCode(), confCode);
    }

    /**
     * 根据配置代码查询页面模板配置信息
     *
     * @param confCode confCode
     * @param appId appId
     * @param ownerCode ownerCode
     * @return java.util.List<com.yonyou.cyxdms.basedata.client.domains.vo.PageTemplateConfVO>
     * @author renwd
     * @since 2019/10/8
     */
    @Override
    public List<PageTemplateConfVO> listPageTemplateConfWithoutLoginInfo(Integer confCode, String appId, String ownerCode) {
        return pageTemplateConfMapper.listPageTemplateConfByConfCode(appId, ownerCode, confCode);
    }
}
